<template>
  <div class="home-banner">
    <XtxCarousel :sliders="sliders" autoPlay></XtxCarousel>
  </div>
</template>

<script>

import { ref } from 'vue'
import API from '@/api/home'

export default {
  name: 'HomeBanner',
  setup() {
    // 获取轮播图数据
    const sliders = ref([])
    API.getBanner().then((res) => {
      sliders.value = res.result
    })

    // console.log(sliders)
    return {
      sliders
    }
  }
}
</script>

<style lang="less" scoped>

.home-banner {
  width: 1240px;
  height: 500px;
  // 注意: home-banner会被一个common.less样式中container类所包裹,
  // 而container是relative相对定位的, 所以与次构成了子绝互相
  position: absolute;
  top: 0;
  left: 0;
  z-index: 98;

  // 覆盖样式
  .xtx-carousel {
    ::v-deep .carousel-btn.prev {
      left: 270px;
    }

    ::v-deep .carousel-indicator {
      padding-left: 250px;
    }
  }
}


</style>
